package routes

import (
	"github.com/goravel/framework/contracts/http"
	"github.com/goravel/framework/facades"
	"goravel/app/http/controllers"
	"goravel/packages/socket/servers"
)

func Web() {
	facades.Route().Get("/", func(ctx http.Context) http.Response {
		return ctx.Response().View().Make("index.html")
	})
	swaggerController := controllers.NewSwaggerController()
	facades.Route().Get("/swagger/*any", swaggerController.Index)
	facades.Route().Static("/dist", "./public/dist")
	facades.Route().Static("/template", "./public/template")

	facades.Route().Static("/icons", "./public/icons")
	// Websocket
	websocketHandler := &servers.Controller{}
	facades.Route().Get("/ws", websocketHandler.Run)
	go servers.Manager.Start()
}
